Skip to content

feat(gooddata-sdk): [AUTO] Add organization dataCenter and region diagnostic deployment fields#1578

Open
yenkins-admin wants to merge 1 commit intomasterfrom
auto/openapi-sync-C016-20260420-r82171
Open

feat(gooddata-sdk): [AUTO] Add organization dataCenter and region diagnostic deployment fields#1578
yenkins-admin wants to merge 1 commit intomasterfrom
auto/openapi-sync-C016-20260420-r82171

Conversation

@yenkins-admin
Copy link
Copy Markdown
Contributor

Summary

Added data_center and region diagnostic deployment fields to CatalogOrganizationAttributes. Both fields are read from the API response (JsonApiOrganizationOutAttributes already contains them in the generated client) but excluded from write requests via a custom to_api() override, since they are absent from JsonApiOrganizationInAttributes. Four unit tests added covering field storage, to_api() exclusion, from_api() population, and graceful handling of absent fields.

Impact: new_feature | Services: gooddata-metadata-client

Files changed

  • packages/gooddata-sdk/src/gooddata_sdk/catalog/organization/entity_model/organization.py
  • packages/gooddata-sdk/tests/catalog/test_catalog_organization.py

Agent decisions

Decisions (3)

placement of data_center and region — Add to CatalogOrganizationAttributes alongside the other organization attributes

  • Alternatives: Add as top-level fields on CatalogOrganization directly
  • Why: The fields appear in the attributes section of the API response (JsonApiOrganizationOutAttributes), making CatalogOrganizationAttributes the semantically correct home. Users access them consistently via organization.attributes.data_center, matching the pattern for name, hostname, etc.

excluding read-only fields from write requests — Override to_api() in CatalogOrganizationAttributes to explicitly construct JsonApiOrganizationInAttributes with only writable fields

  • Alternatives: Rely on None-filtering in _get_snake_dict() — unsafe when fields are non-None, Place fields only on CatalogOrganization to avoid the write-path concern
  • Why: data_center and region are absent from JsonApiOrganizationInAttributes (the write model), so they must not appear in PUT/PATCH bodies. An explicit to_api() override is the safest mechanism, consistent with the as_api_model() kwargs pattern in the architecture guide.

no init.py export change — Leave CatalogOrganizationAttributes unexported

  • Alternatives: Export CatalogOrganizationAttributes for type-hinting convenience
  • Why: CatalogOrganizationAttributes was not previously exported. The new fields are reachable via organization.attributes.data_center without requiring a new public symbol.
Assumptions to verify (3)
  • The API server ignores unknown additional properties in write request bodies — consistent with existing code where oauth_issuer_location and oauth_client_id in CatalogOrganizationAttributes are also absent from JsonApiOrganizationInAttributes.
  • data_center and region are truly server-generated read-only fields that users should never set explicitly; the OpenAPI diff description ('for diagnostic purposes') supports this.
  • safeget(ea, ['data_center']) correctly retrieves the value from a JsonApiOrganizationOutAttributes OpenApiModel via snake_case key lookup, matching how the generated client normalises attribute names.
Risks (2)
  • The existing VCR cassette organization.yaml already contains dataCenter and region as empty strings in the response body (verified), so test_get_organization should pass without re-recording.
  • Unit tests that pass a plain dict to from_api() exercise a slightly different code path than production (which uses a JsonApiOrganizationOut object), but safeget handles both dict and OpenApiModel so the tests remain valid.
Layers touched (2)
  • entity_model — Added data_center and region to CatalogOrganizationAttributes; added to_api() override to exclude them from write requests; updated CatalogOrganization.from_api() to populate them.
    • packages/gooddata-sdk/src/gooddata_sdk/catalog/organization/entity_model/organization.py
  • tests — Added four unit tests (no cassettes): field storage, to_api() exclusion (parametrized), from_api() population, and from_api() absent-field handling.
    • packages/gooddata-sdk/tests/catalog/test_catalog_organization.py

Source commits (gdc-nas)

  • f0f3783 feat(metadata-api): add deployment info to API
  • 2577b31 Merge pull request #21385 from Vojtasii/vto/deployment-info
OpenAPI diff
       "JsonApiOrganizationOutAttributes": {
         "properties": {
+          "dataCenter": {
+            "description": "Data center identifier for diagnostic purposes.",
+            "type": "string"
+          },
+          "region": {
+            "description": "Region identifier for diagnostic purposes.",
+            "type": "string"
+          },
           "hostname": { "type": "string" }
         }
       }

Workflow run


Generated by SDK OpenAPI Sync workflow

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 20, 2026

Codecov Report

❌ Patch coverage is 80.00000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 78.66%. Comparing base (c00ca3b) to head (46663aa).
⚠️ Report is 170 commits behind head on master.

Files with missing lines Patch % Lines
.../catalog/organization/entity_model/organization.py 80.00% 3 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           master    #1578       +/-   ##
===========================================
+ Coverage    0.00%   78.66%   +78.66%     
===========================================
  Files         158      230       +72     
  Lines       11048    15420     +4372     
===========================================
+ Hits            0    12130    +12130     
+ Misses      11048     3290     -7758     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant